package com.heaven.service.remote.impl;

import com.heaven.api.service.TestService;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component
@Scope("singleton")
public class TestServiceImpl implements TestService, BeanNameAware, BeanFactoryAware {
    public TestServiceImpl(){
        System.out.println("service constructor call!");
    }
    @Override
    public void sayHello(String msg) {
        System.out.println(msg );
    }
    @PostConstruct
    public void postConstruct(){
        System.out.println("post construct ...");
    }
    @PreDestroy
    public void sayEnd(){
        System.out.println("PreDestroy ...");
    }


    @Override
    public void setBeanName(String s) {
        System.out.println("Bean name is : "+s);
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {

    }
}
